package com.sh.java核心技术卷1.one基本数据类型;


import java.io.IOException;
import java.util.stream.IntStream;

/**
 * @Auther: sh
 * @Version 1.0
 * @Description:
 */
public class One {
    public static void main(String[] args) throws IOException {
        System.out.println(0x1111);
        System.out.println(1_00_0000 == 1000000);  // true
        System.out.println('A' == 65);  // true
        System.out.println(2.3 / 0);  // Infinity
//        System.out.println(1/0);  // 出异常
        // strictfp关键字  // 用于控制 浮点运算的精度和可移植性，确保浮点计算在所有平台上具有 完全一致的结果。
        System.out.println(compute());
        System.out.println(1.0 / 3.0);


        int m = 7;
        int n = 7;
        int a = 2 * ++m;
        int b = 2 * n++;
        System.out.println(a + "\t" + m);
        System.out.println(b + "\t" + n);

        int x=0;
        int y=1;
        int i = x < y ? x : y;

        int q=1;
        /**
         *   0x1F = 0001 1111
         *   这里的q为int， 32位
         *   这 35 大于 32，所以实际上  在<< 的时候，会对 35 取模处理，对int来说只要低5位
         *   实际上的：    int i1 = q << (35 & 0x1F)   // 35 & 0x1F = 3
         *                              0010 0011
         *                           &  0001 1111
         *                              0000 0011 == 3
         *
         *
         */
        int i1 = q << 35;
        int i2 = q << 3;
        System.out.println(i1 + "\t" + i2);

        String temp = String.join("1", "b","s");
        System.out.println(temp);

        String str1= "HELLO";
        String str2 = "hello";
        System.out.println(str1.equalsIgnoreCase(str2));

        int i3 = str1.codePointCount(0, str1.length());
        System.out.println(i3);

        IntStream intStream = str1.codePoints();
        int[] array = intStream.toArray();

        StringBuilder builder = new StringBuilder();
        StringBuffer stringBuffer = new StringBuffer();
        System.out.println(builder.length());

//        Scanner scanner = new Scanner(System.in);
//        System.out.println("what's your name?");
//        String name = scanner.nextLine();
//        System.out.println(name);
//        String nameNew = scanner.next();
//        System.out.println(nameNew);

//        System.out.printf("%tc", new Date());
//
//        PrintWriter printWriter = new PrintWriter("test.txt", "utf-8");
//        printWriter.write("dsa");
//        printWriter.flush();
//        Path path = Paths.get("D:\\java_workspace\\newaallproject\\test.txt", "utf-8");
//        Scanner scanner = new Scanner(path);
//        System.out.println(scanner.nextLine());





    }

    public static strictfp double compute() {
        return 1.0 / 3.0;
    }

}

